import sys
import os, json
import requests

# sys.path.append("..")
# sys.path.append("../utils")
# os.environ.update({"DJANGO_SETTINGS_MODULE": "server.settings"})
# django.setup()
# from django.test import Client

# client = Client()

baseUrl = u"http://127.0.0.1:8000/api/notice/"


def addNotice():
    iputData = {
        "noticeTitle": "检查报错",
        "noticeContent": "报错11111",
        "token": "61aa3da28253d3877c20",
        'isView': json.dumps([2]),
    }
    res = requests.post(baseUrl + 'publish/', data=iputData)
    print(res.content)


def getNotice():
    iputData = {
        'page': '1',
        'maxItem': '5',
        "token": "15f3911902953e46ce92",
        "noticeState": 0,
    }
    res = requests.post(baseUrl + 'get/', data=iputData)
    print(res.content)


def noticeContent():
    iputData = {
        "noticeId": "3",
        "token": "ece30bbb315a482db8ee",
    }
    res = requests.post(baseUrl + 'content/', data=iputData)
    print(res.content)


def optionNotice():
    iputData = {
        "noticeId": "3",
        "token": "ece30bbb315a482db8ee",
        "option": "1",
    }
    res = requests.post(baseUrl + 'option/', data=iputData)
    print(res.content)


if __name__ == '__main__':
    # addNotice()
    getNotice()
    # noticeContent()
    # optionNotice()
